package com.xiaoyun.alllearning.domain.dto;

import com.xiaoyun.alllearning.util.InsertValidationGroup;
import com.xiaoyun.alllearning.util.UpdateValidationGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

@Data
public class UserDTO implements Serializable {

    /**
     * 用户组信息
     */
    @NotBlank(message = "用户名不能为空！", groups = {InsertValidationGroup.class})
    private String username;

    @NotBlank(message = "密码不能为空！", groups = {InsertValidationGroup.class})
    @Length(min = 6, max = 18, message = "密码长度不能少于6位，不能多于18位！")
    private String password;

    @NotEmpty(message = "邮箱不能为空！", groups = InsertValidationGroup.class)
    @Email(message = "必须为有效邮箱")
    private String email;
    @NotNull(message = "年龄不能为空！", groups = {InsertValidationGroup.class})
    private Integer age;
    @NotBlank(message = "手机号不能为空!", groups = {InsertValidationGroup.class})
    private String phone;

    /**
     * 版本号
     */
    @NotNull(message = "版本不能为空！", groups = {UpdateValidationGroup.class})
    private Long version;

    private LocalDateTime created;

}
